package br.com.abril.task;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import br.com.abril.job.AbstractTask;

import com.force.abril.booking.download.BookingServiceActivator;
import com.force.abril.prevision.download.PrevisionServiceActivator;
import com.sforce.ws.ConnectionException;


public class BookingTask extends AbstractTask  {
	
	private static final Logger logger = Logger.getLogger(BookingTask.class);
	
	private BookingServiceActivator service;
	
	public BookingTask() {
		service = applicationContext.getBean(BookingServiceActivator.class);
	}
	
	@Override
	public void execute() {
		try {
			service.downloadBookings();
			logger.info("................ Dowloaded All Bookings Finished");
		} catch (ConnectionException e) {
			logger.error("Unable to Connect to SalesForce", e);	
		}
	}
	
	

}
